package cc.comac.mom.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipFaultDisplayService;
import cc.comac.mom.bean.EquipFaultDisplay;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.util.ResultBean;

@RestController
@RequestMapping("/EquipFaultDisplay")
public class EquipFaultDisplayController {
	
	@Autowired
	private EquipFaultDisplayService equipFaultDisplayService;
	
	
	@RequestMapping(value = "/insertFaultDisplay",method = RequestMethod.POST)
	public ResultBean insertFaultDisplay(@RequestBody EquipFaultDisplay EquipFaultDisplay) {
			ResultBean resultBean = equipFaultDisplayService.insertFaultDisplay(EquipFaultDisplay);
		
		return resultBean;
	}
	
	@RequestMapping(value = "/batchDelete",method = RequestMethod.POST)
	public ResultBean batchDelete(@RequestBody List<EquipFaultDisplay> list) {
			ResultBean resultBean = equipFaultDisplayService.batchDelete(list);
		return resultBean;
	}
	
	@RequestMapping(value = "/updateFaultDisplay",method = RequestMethod.POST)
	public ResultBean updateFaultDisplay (@RequestBody EquipFaultDisplay equipFaultDisplay) {

			ResultBean resultBean = equipFaultDisplayService.updateFaultDisplay(equipFaultDisplay);
		
		return resultBean;
	}
	
	@RequestMapping(value = "/selectBySomeField",method = RequestMethod.POST)
	public ResultBean selectBySomeField(@RequestBody EquipFaultDisplay equipFaultDisplay) {
		ResultBean resultBean = new ResultBean(true);
		try {
			ResultDev selectBySomeField = equipFaultDisplayService.selectBySomeField(equipFaultDisplay);
			resultBean.setObject(selectBySomeField);
		} catch (Exception e) {
			resultBean.setErrorMessge(e.getMessage());
		}
		return resultBean;
	}

}
